package com.leanit.pmc.reg.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Repository;

/**
 * Created by admin on 2016/3/22.
 */
@Repository
@Lazy
public interface RegDao {
    @Select("select count(1) from reg_mail where mail=#{mail} and mail_send_time > sysdate-1/1400")
    int qryMailSend(@Param("mail") String mail);

    @Select("select count(1) from reg_mail where mail=#{mail} and mail_key=#{mailKey} and reg_date > sysdate-1 and status=1")
    int qryMailKey(@Param("mail") String mail, @Param("mailKey") String mailKey);

    @Select("select max(weight)+1 from sys_organization")
    Integer getOrgWeight();

    @Select("select organization_id from sys_user_organization_job where user_id=#{userId} and rownum<2 order by id desc")
    String getOrgIdByUserId(@Param("userId") String userId);
}
